package com.jk.mapper;

import com.jk.bean.Author;
import com.jk.bean.Chongzhijilu;
import com.jk.bean.Finance;
import com.jk.bean.QQ;
import com.jk.bean.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface UserMapper {
     @Update("update author set sentiment = 1")
    static void deleteSentiment() {
    }


    List<Author> queryWeekSentiment();

    @Update("update author set sentiment = sentiment+1,attention = attention+1, monthattention =monthattention+1 where aid = #{id}")
    void addASentiment(String id);

    @Update("update ${tableName} set bkcount = bkcount+1 where id = #{id}")
    void addArticleAll(@Param("id") String id,@Param("tableName")  String tableName);

    @Select("select * from author where aid = #{id}")
    Author queryAuthor(String id);

    @Select("select * from t_user where userAccout=#{userAccout} and userPwd=#{userPwd}")
    User tologin(User user);

    @Select("select * from author where aid <> #{id}")
    List<Author> querynoAuthor(String id);

    @Select("select t.id,t.bkcount from ${tablename} t where id = #{id} ")
    Finance querybkcount(Finance fn);

    @Update("update t_user set jifen = jifen+${price1} where userId = #{userId}")
    void updatejifen(@Param("price1")Integer price1, @Param("userId")Integer userId);

    void addQQ(QQ qq);

    @Select("select * from t_user where userAccout = #{figureurl1} ")
    User queryUserByIdQQ(QQ qq);
    @Update("update t_user set vipdate = DATE_ADD(vipdate,INTERVAL #{month} MONTH) where userId = #{userId}")
    void updateVipJia(@Param("month")int month, @Param("userId")Integer userId);

    @Update("update t_user set vipdate = DATE_ADD(now(),INTERVAL #{month} MONTH),hy = #{leixing} where userId = #{userId}")
    void updateVipHuan(@Param("leixing")int leixing, @Param("month") int month, @Param("userId") Integer userId);

    @Select("select * from t_user where userId = #{userId}")
    User queryuserbybzname(@Param("userId")Integer userId);

    @Update("update t_user set vipdate = null,hy=1 where userId = #{userId}")
    void updateVipDate(User tologin);

    void chongzhijilu(Chongzhijilu chongZhi2);

    void jifenchongzhi(Chongzhijilu chongZhi2);
    @Select("select * from t_user where userId = #{userId}")
    User queryUserbyid(@Param("userId")String id);
}
